package com.zhichat.infrastructure.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @ClassName: ChatMsgStatusEnum
 * @Description: 发送的消息体的消息状态enum
 * @Author: 团长九哥 https://space.bilibili.com/602197686
 * @CreateDate: 2024/12/12 15:39
 */
@Getter
@AllArgsConstructor
public enum ChatMsgStatusEnum {

    SUCCESS(1, "发送成功"),
    SENDING(2, "发送中"),
    FAIL(3, "发送失败");

    private final Integer code;
    private final String desc;

    public static ChatMsgStatusEnum getEnumByCode(Integer code) {
        for (ChatMsgStatusEnum chatMsgStatusEnum : ChatMsgStatusEnum.values()) {
            if (Objects.equals(chatMsgStatusEnum.getCode(), code)) {
                return chatMsgStatusEnum;
            }
        }
        return null;
    }
}
